#pragma once
#pragma warning(disable:4996)       // disable checked iterator errors http://msdn.microsoft.com/en-us/library/aa985965(VS.80).aspx 

//
// Copyright (C) 2011 - 2013 Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.2 with QuantLib 1.2.1

#include <Macros.h>
#include <ValueHelpers.h>
#include <Settings.h>

#include <gen/QL/Models/Marketmodels/MarketModelEvolver.h>
#pragma unmanaged 
#include <ql\models\marketmodels\evolvers\lognormalcmswapratepc.hpp>
#include <boost/smart_ptr/detail/spinlock.hpp>
#pragma managed 

using namespace System;
using namespace QuantLib;
using namespace Cephei;
using namespace Cephei::Core;
using namespace PLATFORM::Collections;

using namespace Cephei::QL::Models::Marketmodels;
#undef HANDLE
#undef ABSTRACT
#undef STRUCT
namespace Cephei { namespace QL { namespace Models { namespace Marketmodels { namespace Evolvers {
	//////////////////////////////////////////////////////////////////////////////////////////////
	// implementation of ILogNormalCmSwapRatePc
	public ref class CLogNormalCmSwapRatePc  : 
            public CMarketModelEvolver,
            public Cephei::QL::Models::Marketmodels::Evolvers::ILogNormalCmSwapRatePc
	{
	protected: 
		boost::shared_ptr<QuantLib::LogNormalCmSwapRatePc>* _ppLogNormalCmSwapRatePc;
#ifdef HANDLE
		QuantLib::Handle<QuantLib::LogNormalCmSwapRatePc>* _phLogNormalCmSwapRatePc;
#endif
		Object^ _LogNormalCmSwapRatePcOwner;     // reference to object that manages the storage for this object
	internal:
		CLogNormalCmSwapRatePc (UInt64 spanningForwards, Cephei::QL::Models::Marketmodels::IMarketModel^ marketModel, Cephei::QL::Models::Marketmodels::IBrownianGeneratorFactory^ factory, Cephei::Core::IVector<UInt64>^ numeraires, Microsoft::FSharp::Core::FSharpOption<UInt64>^ initialStep);
        CLogNormalCmSwapRatePc (boost::shared_ptr<QuantLib::LogNormalCmSwapRatePc>& childNative, Object^ owner);
        CLogNormalCmSwapRatePc (QuantLib::LogNormalCmSwapRatePc& childNative, Object^ owner);
        CLogNormalCmSwapRatePc (CLogNormalCmSwapRatePc^ copy);
        CLogNormalCmSwapRatePc (PLATFORM::Type^ t);
#ifdef STRUCT
        CLogNormalCmSwapRatePc (QuantLib::LogNormalCmSwapRatePc childNative);
#endif       
#ifdef HANDLE
		CLogNormalCmSwapRatePc (QuantLib::Handle<QuantLib::LogNormalCmSwapRatePc>& childNative, Object^ owner);
		CLogNormalCmSwapRatePc (QuantLib::Handle<QuantLib::LogNormalCmSwapRatePc> childNative);
#endif
		virtual ~CLogNormalCmSwapRatePc ();
		!CLogNormalCmSwapRatePc ();

	internal:
		QuantLib::LogNormalCmSwapRatePc& GetReference ();
		boost::shared_ptr<QuantLib::LogNormalCmSwapRatePc>& GetShared ();
		QuantLib::LogNormalCmSwapRatePc* GetPointer ();
        void SetLogNormalCmSwapRatePc (boost::shared_ptr<QuantLib::LogNormalCmSwapRatePc> native)
        {
            if (_ppLogNormalCmSwapRatePc != NULL)
                delete _ppLogNormalCmSwapRatePc;
            _ppLogNormalCmSwapRatePc = new boost::shared_ptr<QuantLib::LogNormalCmSwapRatePc> (native);
            SetMarketModelEvolver (boost::dynamic_pointer_cast<QuantLib::MarketModelEvolver> (*_ppLogNormalCmSwapRatePc));
        }
#ifdef HANDLE
		QuantLib::Handle<QuantLib::LogNormalCmSwapRatePc>& GetHandle ();
#endif
		virtual bool HasNative () override;
    public:
        property Double AdvanceStep 
        {
		    virtual Double get () ;
        }
        property Cephei::QL::Models::Marketmodels::ICurveState^ CurrentState 
        {
		    virtual Cephei::QL::Models::Marketmodels::ICurveState^ get () ;
        }
        property UInt64 CurrentStep 
        {
		    virtual UInt64 get () ;
        }
        property Cephei::Core::IVector<UInt64>^ Numeraires 
        {
		    virtual Cephei::Core::IVector<UInt64>^ get () ;
        }
		virtual Cephei::QL::Models::Marketmodels::Evolvers::ILogNormalCmSwapRatePc^ SetInitialState (Cephei::QL::Models::Marketmodels::ICurveState^ cs) ;
        property Double StartNewPath 
        {
		    virtual Double get () ;
        }
    };
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Factory class
//z	[FactoryFor(Core::Generic::ICoCell<Cephei::QL::Models::Marketmodels::Evolvers::ILogNormalCmSwapRatePc^>::typeid)]
	[FactoryFor(Cephei::QL::Models::Marketmodels::Evolvers::ILogNormalCmSwapRatePc::typeid)]
	[FactoryFor(Cephei::QL::Models::Marketmodels::Evolvers::ILogNormalCmSwapRatePc_Factory::typeid)]
	public ref class CLogNormalCmSwapRatePc_Factory sealed : public ILogNormalCmSwapRatePc_Factory
	{
	public:
        virtual ILogNormalCmSwapRatePc^ Create (UInt64 spanningForwards, Cephei::QL::Models::Marketmodels::IMarketModel^ marketModel, Cephei::QL::Models::Marketmodels::IBrownianGeneratorFactory^ factory, Cephei::Core::IVector<UInt64>^ numeraires, Microsoft::FSharp::Core::FSharpOption<UInt64>^ initialStep);
    };
   
/*Cephei*/ } /*QL*/ } /*Models*/ } /*Marketmodels*/ } /*Evolvers */}
